package k4_thread.demo04;

public class ThreadOne {

    public static void main(String[] args) {

        Phone1 phone = new Phone1();

        //第一个线程，表示发送短信
        new Thread(()->phone.sendMessage()).start();
        //第二个线程，表示打电话
        new Thread(()->phone.callPhone()).start();
    }

}

class Phone1{

    public synchronized void sendMessage(){
        System.out.println("=====发短信=====");
    }

    public synchronized void callPhone(){
        System.out.println("=====打电话=====");
    }

}
